--# LUXOR MODEL #
function buildLuxorModel( frameID, basePath )
	local frameTable = {}
	
	-- Root
	frameTable.root = Transform()
	
	-- Base
	local base = {}
	base.root = Transform()
	base.entity_a = Entity( scene.asset["luxorTexture"], Mesh( basePath .. "base_a.msh" ) )
	base.entity_b = Entity( scene.asset["luxorTexture"], Mesh( basePath .. "base_b.msh" ) )
	
	-- Beam 1
	local beam1 = {}
	beam1.root = Transform()
	beam1.entity = Entity( scene.asset["luxorTexture"], Mesh( basePath .. "haste1.msh" ) )
	
	-- Beam 2
	local beam2 = {}
	beam2.root = Transform()
	beam2.entity = Entity( scene.asset["luxorTexture"], Mesh( basePath .. "haste2.msh" ) )
	
	-- Beam 3
	local beam3 = {}
	beam3.root = Transform()
	beam3.entity_a = Entity( scene.asset["luxorTexture"], Mesh( basePath .. "haste3_a.msh" ) )
	beam3.entity_b = Entity( scene.asset["luxorTexture"], Mesh( basePath .. "haste3_b.msh" ) )
	
	-- Dome
	local dome = {}
	dome.root = Transform()
	dome.entity_a = Entity( scene.asset["luxorTexture"], Mesh( basePath .. "cupula_a.msh" ) )
	dome.entity_b = Entity( scene.asset["luxorTexture"], Mesh( basePath .. "cupula_b.msh" ) )
	
	-- Bulb
	local bulb = {}
	bulb.root = Transform()
	bulb.entity = Entity( scene.asset["luxorBulbMat"], Mesh( basePath .. "lampada.msh" ) )
	
	-- Position parts
	base.root:rotate    ( 0,     0, 0 )
	beam1.root:translate( 0,  4.00, 0 )
	beam2.root:translate( 0, 17.15, 0 )
	beam3.root:translate( 0, 16.78, 0 )
	dome.root:translate ( 0, 18.12, 0 )
	bulb.root:translate ( 0,  8.40, 9 )
	
	-- Build SceneGraph hierarchy
	frameTable.base = base
	frameTable.base.beam1 = beam1
	frameTable.base.beam1.beam2 = beam2
	frameTable.base.beam1.beam2.beam3 = beam3
	frameTable.base.beam1.beam2.beam3.dome = dome
	frameTable.base.beam1.beam2.beam3.dome.bulb = bulb
	
	-- Set names
	frameTable.root:setName( "Luxor Model (Frame "         .. frameID .. ")" )
	base.root:setName      ( "Luxor Base (Root) (Frame "   .. frameID .. ")" )
	base.entity_a:setName  ( "Luxor Base A (Frame "        .. frameID .. ")" )
	base.entity_b:setName  ( "Luxor Base B (Frame "        .. frameID .. ")" )
	beam1.root:setName     ( "Luxor Beam 1 (Root) (Frame " .. frameID .. ")" )
	beam1.entity:setName   ( "Luxor Beam 1 (Frame "        .. frameID .. ")" )
	beam2.root:setName     ( "Luxor Beam 2 (Root) (Frame " .. frameID .. ")" )
	beam2.entity:setName   ( "Luxor Beam 2 (Frame "        .. frameID .. ")" )
	beam3.root:setName     ( "Luxor Beam 3 (Root) (Frame " .. frameID .. ")" )
	beam3.entity_a:setName ( "Luxor Beam 3A (Frame "       .. frameID .. ")" )
	beam3.entity_b:setName ( "Luxor Beam 3B (Frame "       .. frameID .. ")" )
	dome.root:setName      ( "Luxor Dome (Root) (Frame "   .. frameID .. ")" )
	dome.entity_a:setName  ( "Luxor Dome A (Frame "        .. frameID .. ")" )
	dome.entity_b:setName  ( "Luxor Dome B (Frame "        .. frameID .. ")" )
	bulb.root:setName      ( "Luxor Bulb (Root) (Frame "   .. frameID .. ")" )
	bulb.entity:setName    ( "Luxor Bulb (Frame "          .. frameID .. ")" )
	
	-- Set Toon Shading options
	base.entity_a:setToonShading( toonShading )
	base.entity_b:setToonShading( toonShading )
	beam1.entity:setToonShading( toonShading )
	beam2.entity:setToonShading( toonShading )
	beam3.entity_a:setToonShading( toonShading )
	beam3.entity_b:setToonShading( toonShading )
	dome.entity_a:setToonShading( toonShading )
	dome.entity_b:setToonShading( toonShading )
	bulb.entity:setToonShading( toonShading )
	
	base.entity_a:setToonBorderWidth( toonBorderWidth )
	base.entity_b:setToonBorderWidth( toonBorderWidth )
	beam1.entity:setToonBorderWidth( toonBorderWidth )
	beam2.entity:setToonBorderWidth( toonBorderWidth )
	beam3.entity_a:setToonBorderWidth( toonBorderWidth )
	beam3.entity_b:setToonBorderWidth( toonBorderWidth )
	dome.entity_a:setToonBorderWidth( toonBorderWidth )
	dome.entity_b:setToonBorderWidth( toonBorderWidth )
	bulb.entity:setToonBorderWidth( toonBorderWidth )
	
	base.entity_a:setToonBorderColor( toonBorderColor[1], toonBorderColor[2], toonBorderColor[3], toonBorderColor[4] )
	base.entity_b:setToonBorderColor( toonBorderColor[1], toonBorderColor[2], toonBorderColor[3], toonBorderColor[4] )
	beam1.entity:setToonBorderColor( toonBorderColor[1], toonBorderColor[2], toonBorderColor[3], toonBorderColor[4] )
	beam2.entity:setToonBorderColor( toonBorderColor[1], toonBorderColor[2], toonBorderColor[3], toonBorderColor[4] )
	beam3.entity_a:setToonBorderColor( toonBorderColor[1], toonBorderColor[2], toonBorderColor[3], toonBorderColor[4] )
	beam3.entity_b:setToonBorderColor( toonBorderColor[1], toonBorderColor[2], toonBorderColor[3], toonBorderColor[4] )
	dome.entity_a:setToonBorderColor( toonBorderColor[1], toonBorderColor[2], toonBorderColor[3], toonBorderColor[4] )
	dome.entity_b:setToonBorderColor( toonBorderColor[1], toonBorderColor[2], toonBorderColor[3], toonBorderColor[4] )
	bulb.entity:setToonBorderColor( toonBorderColor[1], toonBorderColor[2], toonBorderColor[3], toonBorderColor[4] )
	
	return frameTable
end
